package cn.lanqiao.print;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class Printer {
    //1、@Autowired byType 【 + @Qualifier = byName】
    //2、@Resource byName
    @Resource(name="b5")
    private Paper paper;
    @Autowired
    @Qualifier("blackInk")
    private Ink ink;
    @Value("佳能")
    private String brand;

    public Printer(){

    }

    public Printer(String brand) {
        this.brand = brand;
    }

    public Printer(Paper paper, Ink ink, String brand) {
        this.paper = paper;
        this.ink = ink;
        this.brand = brand;
    }

    public void print(String words){
        System.out.println(brand + "打印机正在使用" + ink.getColor() +"墨盒和" + paper.getSize() + "纸张打印：");
        System.out.println(words);
    }

    public Paper getPaper() {
        return paper;
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    public Ink getInk() {
        return ink;
    }
    public void setInk(Ink ink) {
        this.ink = ink;
    }

    public String getBrand() {
        return brand;
    }

}
